<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>加载事件监听事件</title>
</head>
<body>
<button id="myBut">点击监听器</button>
<script type="text/javascript">
    document.getElementById("myBut").addEventListener(
        "click",
        myFunction
    );
    function myFunction() {
        alert("Hello World!");
    }
</script>

</body>
</html>